#import <CoreFoundation/CoreFoundation.h>
#import <Foundation/Foundation.h>
#import <UIKit/CDStructures.h>
#import <UIKit/UIHardware.h>
#import <UIKit/UIApplication.h>
#import <UIKit/UIKit.h>
#import <UIKit/UIPreferencesTableCell.h>

#import "ToDo.h"


@class MobileToDoListApplication;

@interface ToDoManager : NSObject {
	NSMutableArray *todos;
	NSMutableArray *possibleGroups;
	NSMutableArray *groupSplits;
	NSString *currentFile;
	NSString *currentGroupFile;
	NSString *currentPreferenceFile;
	
	NSMutableDictionary *preferences;
	
	int currentToDo;
	int currentGroup;
	
	MobileToDoListApplication *td;
}

+ (ToDoManager *)sharedToDoManager;
- (int)addToDo:(ToDo *)myToDo;
- (void)updateIconInfo;
- (int)getGroupNumberBySplitsFromToDo:(int)myToDo;
- (int)getTodoCountInGroup:(int)myGroup;
- (void)fixOrder;
- (void)orderTodosByGroup;

-(void)setPref:(NSString *)myKey withValue:(NSString *)myValue;
-(NSString *)getPref:(NSString *)myKey;

- (NSMutableArray *)todos;
- (int)numberOfTodos;
- (int)numberOfOpenTodos;
- (void)removeToDo:(int)myToDo;
- (void)setCurrentFile:(NSString *)myFile;
- (void)setCurrentGroupFile:(NSString *)myFile;
- (void)setCurrentPreferenceFile:(NSString *)myFile;
- (void)setCurrentToDo:(int)myToDo;
- (int)getCurrentToDo;
- (int)getNextUnnamed;
- (int)getNextUnnamedGroup;
- (NSString *)getCurrentToDoDescription;
- (void)setDescription:(NSString *)myDescription forToDo:(int)myToDo;
- (NSCalendarDate *)setDueDate:(NSCalendarDate *)myDate forToDo:(int)myToDo;
- (NSCalendarDate *)getDueDateFromToDo:(int)myToDo;
- (NSCalendarDate *)setCreationDate:(NSCalendarDate *)myDate forToDo:(int)myToDo;
- (NSCalendarDate *)getCreationDateFromToDo:(int)myToDo;
- (NSString *)getDescriptionFromToDo:(int)myToDo;
- (void)setDone:(int)myDoneState forToDo:(int)myToDo;
- (void)writeToFile;
- (void)loadFile;
- (int)getGroupNumberFromToDo:(int)myToDo;
- (NSString *)getGroupNameFromToDo:(int)myToDo;
- (void)setGroup:(int)myGroup forToDo:(int)myToDo;
- (int)getDoneFromToDo:(int)myToDo;
- (void)swapDoneforToDo:(int)myToDo;
- (void)setPriority:(int)myPrio forToDo:(int)myToDo;
- (int)getPriorityfromToDo:(int)myToDo;
- (BOOL)isToDoExpired:(int)myToDo;

- (NSMutableArray *)getPossibleGroups;
- (int) getCurrentGroup;
- (NSString *) getCurrentGroupName;
- (void) setCurrentGroup:(int)myGroup;
- (void)removeCurrentGroup;
- (NSMutableArray *)getGroupSplits;
- (int)addGroup:(NSString *)groupName;
- (void)setGroup:(NSString *)myGroupName atIndex:(int)myIndex;
- (void)setPosition:(int)myPosition forToDo:(int)myToDo;
- (int)getPositionFromToDo:(int)myToDo;

- (void)writePreferences;
- (void)loadPreferences;

@end
